package com.bdqn.util;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;

public class JdbcUtil {

	static {
		try {
			//加载数据库驱动
			Class.forName(PropertiesUtil.getProperty(KeyConstants.MYSQL_DRIVER_PATH_KEY));
		} catch (ClassNotFoundException e) {
			e.printStackTrace();
		}
	}
	
	//获取数据库连接
	public static Connection getConnection() {
		
		try {
			return DriverManager.getConnection(PropertiesUtil.getProperty(KeyConstants.DB_SERVER_URL_KEY), PropertiesUtil.getProperty(KeyConstants.DB_SERVER_USER_KEY), PropertiesUtil.getProperty(KeyConstants.DB_SERVER_PASSWORD_KEY));
		} catch (SQLException e) {
			e.printStackTrace();
		}
		return null;
	}
	
	
	
}
